﻿@model Order
@{
    ViewBag.Title = "Checkout";
}

<h2>Checkout</h2>

@using(Html.BeginForm("Purchase", "Order")){
    <div class="row form-group">
        <div class="col-md-4">Customer Id:</div>
        <div class="col-md-6">
            @Html.TextBoxFor(o => o.CustomerId, new { @class = "form-control" })
        </div>
    </div>

    <div class="row form-group">
        <div class="col-md-4">Order Date:</div>
        <div class="col-md-6">
            @Html.TextBoxFor(o => o.OrderDate, "{0:MM/dd/yyyy}", new { @class = "form-control", @readonly = true })
        </div>
    </div>

    <div class="row form-group">
        <div class="col-md-4">Required Date:</div>
        <div class="col-md-6">
            @Html.TextBoxFor(o => o.RequireDate, "{0:MM/dd/yyyy}", new { @class = "form-control" })
        </div>
    </div>

    <div class="row form-group">
        <div class="col-md-4">Receiver Name:</div>
        <div class="col-md-6">
            @Html.TextBoxFor(o => o.Receiver, new { @class = "form-control" })
        </div>
    </div>

    <div class="row form-group">
        <div class="col-md-4">Address:</div>
        <div class="col-md-6">
            @Html.TextBoxFor(o => o.Address, new { @class = "form-control" })
        </div>
    </div>

    <div class="row form-group">
        <div class="col-md-4">Total Amount:</div>
        <div class="col-md-6">
            @Html.TextBoxFor(o => o.Amount, new { @class = "form-control", @readonly=true })
        </div>
    </div>

    <div class="row form-group">
        <div class="col-md-4">Notes:</div>
        <div class="col-md-6">
            @Html.TextAreaFor(o => o.Description, new { @class = "form-control", rows="5" })
        </div>
    </div>

    <hr />
    <div class="row form-group">
        <div class="col-md-4"></div>
        <div class="col-md-6">
            <button class="btn btn-default">Purchase</button>
            <a href="#" class="btn btn-default">Coninue Shopping</a>
        </div>
    </div>
}
<fieldset>
    <legend>Hàng đã chọn</legend>
    <table class="table">
        <tr>
            <th>Id</th>
            <th>Name</th>
            <th>Price</th>
            <th>Quantity</th>
            <th>Amount</th>
        </tr>
        @{
            var Cart = EShopV20.Models.ShoppingCart.Cart;
            foreach (var p in Cart.Items)
            {
                <tr>
                    <td>@p.Id</td>
                    <td>@p.Name</td>
                    <td>@p.UnitPrice</td>
                    <td>@p.Quantity</td>
                    <td>@(p.UnitPrice*p.Quantity*(1-p.Discount))</td>
                </tr>
            }
        }
        <tr>
            <th colspan="4">Total:</th>
            <th>@Cart.Amount</th>
        </tr>
    </table>
</fieldset>